// 导入样式文件
import './assets/index.less'
// 处理Promise
import '@babel/polyfill'

import obj from './modelA.js'
console.log(obj.sum(1, 2, 3, 4))

import { average } from './modelB.js'
console.log(average(1, 2, 3, 4))

// 简书
fetch('/asimov/subscriptions/recommended_collections')
  .then((response) => {
    return response.json()
  })
  .then((value) => {
    console.log(value)
  })

function getNum() {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (Math.random() > 0.5) {
        resolve('1')
      }
      reject('2')
    }, 1000)
  })
}

getNum()
  .then((value) => {
    console.log(value)
  })
  .catch((err) => {
    console.log(err)
  })
